<?php if (!defined('BASEPATH')) exit('No direct script access allowed');

function smarty_block_news_slishow($params, $tagdata, $smarty, $repeat){
	$smarty->CI->load->model('news/news_model');
	$latest_news = array();
	$html = "";
	$latest_news = $smarty->CI->news_model->get_news(array('limit'=>5));

	foreach ($latest_news as $latest_new){
	$thecontent = "";
	$thecontent .= "<a class=\"fon1 mt2\" title=\"".$latest_new['name']."\" href=\"".$latest_new['link']."\">".$latest_new['name']."</a>\n";
	$thecontent .="<p>".$latest_new['introtext']."</p>";
	$html .= '
		<div class="news_style slide">
			<div class="slide-inner">
				<a  href="#" >
					<img src="'.$latest_new['image'].'" alt="'.$latest_new['name'].'" />
				</a>
			</div>
				<div class="introtext">
					<div class="slidetext">'.$thecontent.'</div>
				</div>
		</div>
		';
	}

	$content ='<div class="blocnews" >
			<div id="showhere3" class="news_show">
			</div>
			<div id="mynews">
				'.$html.'
			</div>
        <div id="news_button3" class="buttondiv">
                <img id="news_prev" align="absmiddle" alt="prev" src="images/prev.gif">
				<img id="news_pause" align="absmiddle" alt="pause" src="images/pause.gif">
				<img id="news_next" align="absmiddle" alt="next" src="images/next.gif">
        </div>
    </div>';

	$smarty->assign('news_slishow',$content);
	echo $tagdata;
}